const mongoose = require('mongoose')
const Schema = mongoose.Schema
const { name } = require('../public/javascripts/utils');
//  分类

const schema = new Schema({
  name: { type: String, required: true, unique: true }, // 分类名称
  description: { type: String, default: '' }, // 分类描述
  userId: { type: Schema.Types.ObjectId, ref: 'users', required: true }, // 分类所属的用户ID
  createdAt: { type: Date, default: Date.now }, // 创建时间
  updatedAt: { type: Date, default: Date.now } // 更新时间
})
module.exports = mongoose.model(name(__filename), schema)